﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace Stock.Core
{
    public class MySprite : Window
    {
        public MySprite()
        {
            WindowStyle = WindowStyle.None;
            AllowsTransparency = true;
        }

        public void Show(object content)
        {
            Content = content;

            Show();

            var desktopWorkingArea = SystemParameters.WorkArea;
            Left = desktopWorkingArea.Width - ActualWidth - 50;
            Top = 50 - Padding.Top;
        }

        public void Update(object data)
        {
            if (Content != null)
            {
                if (Content is FrameworkElement element)
                {
                    element.DataContext = data;
                }
            }
        }
    }
}
